﻿<?xml version="1.0" encoding="utf-8"?>

<!--  
  If you change this file you will need to regenerate the class definition.  
  Run the following from a visual studio command prompt (so that xsd.exe is in your path):
  
  cd <folder containing this xsd file>
  xsd.exe /classes /n:ZYO.Persistence.Obj /o:.\ ZYOObjectXml.xsd
-->
<xs:schema targetNamespace="http://tempuri.org/ZYO" xmlns="http://tempuri.org/ZYO" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:include schemaLocation="ZYOBaseXml.xsd"/>
  <xs:include schemaLocation="ZYORules.xsd"/>

  <xs:attributeGroup name="BaseAttributes">
    <xs:attribute name="五行属性de枚举值" type="enum五行" use="required"/>
    <xs:attribute name="阴阳" type="xs:boolean" use="required"/>
  </xs:attributeGroup>

  <xs:complexType name="天干">
    <xs:attribute name="枚举值" type="enum天干" use="required"/>
    <xs:attribute name="八字六神de枚举值" type="enum八字六神" use="optional"/>
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="地支">
    <xs:attribute name="枚举值" type="enum地支" use="required"/>
    <xs:attribute name="地蔵天干" type="xs:string" use="required"/>
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="甲子">
    <xs:sequence>
      <xs:element minOccurs="2" maxOccurs="2" name="旬空" type="地支"/>
    </xs:sequence>
    <xs:attribute name="枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="干de枚举值" type="enum天干" use="required"/>
    <xs:attribute name="支de枚举值" type="enum地支" use="required"/>
    <xs:attribute name="旬首de枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="上元符头de枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="所属之元de枚举值" type="enum元" use="required"/>
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="节气">
    <xs:attribute name="枚举值" type="enum节气" use="required"/>
    <xs:attribute name="节气日期" type="xs:dateTime" use="required"/>
    <xs:attribute name="日甲子de枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="节气上元符头de枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="闰节气上元符头de枚举值" type="enum甲子" use="required"/>
    <xs:attribute name="is闰" type="xs:boolean" use="required"/>
    <xs:attribute name="JQBaseTime1996" type="xs:dateTime" use="required"/>
    <xs:attribute name="上元之局" type="xs:byte" use="required"/>
    <xs:attribute name="中元之局" type="xs:byte" use="required"/>
    <xs:attribute name="下元之局" type="xs:byte" use="required"/>
    <xs:attribute name="iLocation" type="xs:byte" use="required"/>
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="ZYDateTime">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1"  name="年" type="甲子"/>
      <xs:element minOccurs="1" maxOccurs="1"  name="月" type="甲子" />
      <xs:element minOccurs="1" maxOccurs="1"  name="日" type="甲子" />
      <xs:element minOccurs="1" maxOccurs="1"  name="时" type="甲子" />
      <xs:element minOccurs="1" maxOccurs="1"  name="本月的节气" type="节气" />
      <xs:element minOccurs="1" maxOccurs="1"  name="所处节气" type="节气" />
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required"/>
    <xs:attribute name="当前时间" type="xs:dateTime" use="required"/>
    <xs:attribute name="所处之局" type="xs:byte" use="required"/>
  </xs:complexType>

  <xs:complexType name="八卦">
    <xs:attribute name="枚举值" type="enum八卦ID" use="required"/>
    <xs:attribute name="先天数de枚举值" type="enum先天八卦" use="required"/>
    <xs:attribute name="方向" type="xs:string" use="required"/>
    <xs:attribute name="下卦地支de枚举值" type="enum地支" use="required"/>
    <!--<xs:attribute name="上卦地支de枚举值" type="enum地支" use="required"/>-->
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="爻">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1"  name="爻辞" type="xs:string"/>
      <xs:element minOccurs="0" maxOccurs="1"  name="变爻" type="爻"/>
    </xs:sequence>
    <xs:attribute name="序号0起" type="xs:unsignedByte" use="required"/>
    <xs:attribute name="Name" type="xs:string" use="required"/>
    <xs:attribute name="六亲de枚举值" type="enum六神" use="required"/>
    <xs:attribute name="地支de枚举值" type="enum地支" use="required"/>
    <xs:attribute name="动否" type="xs:boolean" use="required"/>
    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="六十四卦">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1"  name="卦象" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="彖曰" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="象曰" type="xs:string" />
      <xs:element minOccurs="6" maxOccurs="6" name="爻s" type="爻"/>
      <xs:element minOccurs="1" maxOccurs="1" name="世爻" type="爻"/>
      <xs:element minOccurs="1" maxOccurs="1" name="应爻" type="爻"/>
      <xs:element minOccurs="1" maxOccurs="1" name="上卦" type="八卦"/>
      <xs:element minOccurs="1" maxOccurs="1" name="下卦" type="八卦"/>
      <xs:element minOccurs="1" maxOccurs="1" name="八卦卦宫" type="八卦"/>
    </xs:sequence>
    <xs:attribute name="枚举值" type="enum六十四卦ID" use="required"/>
    <xs:attribute name="变卦记录ID" type="xs:unsignedByte" use="required"/>
    <xs:attribute name="序号Number" type="enum六十四卦by数" use="required"/>
    <xs:attribute  name="互卦de枚举值" type="enum六十四卦ID" use="required"/>
    <xs:attribute  name="卦宫de枚举值" type="enum六十四卦ID" use="required"/>
    <xs:attribute  name="变卦de枚举值" type="enum六十四卦ID" use="required"/>

    <xs:attributeGroup ref="BaseAttributes"/>
  </xs:complexType>

  <xs:complexType name="六爻之爻">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1"  name="Persistence爻" type="爻" />
      <xs:element minOccurs="0" maxOccurs="1"  name="变爻" type="六爻之爻" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="动爻之克我" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="动爻之生我" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="动爻之冲我" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="动爻之合我" type="xs:unsignedByte" />
    </xs:sequence>
    <!--//各个爻的月建状态 旺，次旺，相，余气，休囚，月破-->
    <xs:attribute  name="爻之月建状态" type="e月建旺相" use="required"/>
    <!--//生旺库绝-->
    <xs:attribute  name="日建生旺库绝" type="e生旺库绝" use="required"  />
    <!--//各个爻的月建状态	临日建，生，克，冲，合-->
    <xs:attribute name="月建之生克" type="e五行生克关系" use="required" />
    <xs:attribute name="月建之冲合" type="e地支冲合关系" use="required" />
    <!--//各个爻的日建状态	临日建，生，克，冲，合-->
    <xs:attribute name="日建之生克" type="e五行生克关系" use="required" />
    <xs:attribute name="日建之冲合" type="e地支冲合关系" use="required" />
    <!--//生，克，冲，合-->
    <xs:attribute name="爻之日月综合旺相" type="e爻之旺相" use="required"/>
    <!--//化进退， 化长生化库-->
    <xs:attribute  name="动爻变化之生克" type="e五行生克关系" use="required" />
    <xs:attribute  name="动爻变化之冲合" type="e地支冲合关系" use="required" />
    <xs:attribute  name="动爻变化之进退" type="e动化进退" use="required" />
    <xs:attribute  name="动爻变化之生旺库绝" type="e生旺库绝" use="required" />
    <xs:attribute  name="旬空" type="xs:boolean" use="required" />
    <xs:attribute  name="暗动" type="xs:boolean" use="required" />
    <xs:attribute  name="可用否" type="e有用无用" use="required"/>
  </xs:complexType>

  <xs:complexType name="起卦文件">
    <xs:sequence>
      <xs:element name="日期甲子" type="xs:string"/>
      <xs:element name="卦名" type="xs:string"/>
      <xs:element minOccurs="1" maxOccurs="1"  name="卦象" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="彖曰" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1"  name="象曰" type="xs:string" />
      <xs:element name="UI" type="xs:string"/>
      <xs:element name="批注" type="xs:string"/>
    </xs:sequence>
    <xs:attribute  name="日期" type="xs:dateTime" use="required" />
    <xs:attribute  name="用神de六神" type="enum六神" use="required" />
    <xs:attribute  name="起卦方法" type="e起卦方法" use="required" />
    <xs:attribute  name="本卦记录的ID" type="xs:unsignedByte" use="required" />
    <xs:attribute  name="变卦记录ID" type="xs:unsignedByte" use="required" />
  </xs:complexType>
                  
  <xs:complexType name="六爻起卦">
    <xs:sequence>
      <xs:element name="文件" type="起卦文件"/>
      <xs:element name="起卦日期" type="ZYDateTime"/>
      <xs:element name="本卦" type="六十四卦"/>
      <xs:element minOccurs="6" maxOccurs="6"  name="六爻s" type="六爻之爻" />
      <xs:element minOccurs="1" maxOccurs="1"  name="世爻" type="xs:unsignedByte" />
      <xs:element minOccurs="1" maxOccurs="1"  name="应爻" type="xs:unsignedByte" />
      <xs:element minOccurs="1" maxOccurs="1"  name="用神" type="六爻之爻" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="元神s" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="忌神s" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="仇神s" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="动爻s" type="xs:unsignedByte" />
      <xs:element minOccurs="0" maxOccurs="unbounded"  name="符合的规则" type="六爻规则" />
    </xs:sequence>
    <xs:attribute  name="is用神不现" type="xs:boolean" use="required" />
  </xs:complexType>

  <xs:element name="TG" type="天干"/>
  <xs:element name="六爻起卦" type="六爻起卦"/>

</xs:schema>
